var path = require('path');
const htmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
	mode: 'development',
	// 		entry:'./src/index.js',
	// 		output: {
	// 				path: path.resolve(__dirname, 'dist'), // 设置产品的输出目录
	// 				filename: 'bundle.js'
	// 		}
	plugins: [
		new htmlWebpackPlugin({
			template: path.join(__dirname, 'src/index.html'), //需要打样的文件
			filename: 'index.html' //生成的文件
		})
	],
	module: {
		rules: [{
				test: /\.css$/,
				use: ['style-loader', 'css-loader']
			},
			{
				test: /\.less$/,
				use: ['style-loader', 'css-loader?modules', 'less-loader']
			},
			{
				test: /\.scss$/,
				use: ['style-loader', 'css-loader?modules', 'sass-loader']
			},
			{
				test: /\.(jpg|png|gif|bmp|jpeg)$/,
				use: 'url-loader'
			},
			{
				test: /\.(ttf|eot|svg|woff|woff2)$/,
				use: 'url-loader'
			}, 
			{
				test: /\.js|jsx$/,
				use: 'babel-loader',
				exclude: /node_modules/
			}
		]
	},
	resolve:{
	  extensions: ['.js', '.jsx', '.json'], // 表示，这几个文件的后缀名，可以省略不写
	  alias: {
	      '@': path.join(__dirname, './src')
	  }
	}
}
